package com.atguigu.pratice;

import java.util.Scanner;

public class TheSeries1 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        StringBuilder sb=new StringBuilder();
        while(n!=0){
            sb.append(n%2);
            n/=2;
        }
        String string = sb.reverse().toString();
        int max=0;
        int tmp=0;
        for(int i=0;i<string.length();i++){
            if(string.charAt(i)=='1'){
                tmp++;
                if(tmp>max){
                    max=tmp;
                }
            }else{
                tmp=0;
            }
        }
        System.out.println(max);
    }
}
